function emptyAction() {
  // 警告：提示当前使用的是空 Action
  console.warn("Current execute action is empty!");
}
export interface Actions {
  onGlobalStateChange: () => void;
  setGlobalState: () => void;
  [propName: string]: any;
}
class MicroAppAction {
  actions: Actions;
  constructor() {
    this.actions = {
      onGlobalStateChange: emptyAction,
      setGlobalState: emptyAction
    };
  }
  /**
   * 设置 actions
   */
  setActions(actions: Actions): void {
    this.actions = actions;
  }

  /**
   * 映射
   */
  onGlobalStateChange(...args: any[]) {
    return this.actions.onGlobalStateChange(...(args as []));
  }

  /**
   * 映射
   */
  setGlobalState(...args: any[]) {
    return this.actions.setGlobalState(...(args as []));
  }
}

export default new MicroAppAction();
